package com.adam.masterSpringMVC4.weibo;

import com.fasterxml.jackson.annotation.JsonView;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class WeiboData implements Serializable {

    public interface SimpleView{}
    public interface DetailView extends SimpleView{}

    @JsonView(DetailView.class)
    private String userImageUrl;
    @JsonView(DetailView.class)
    private String userName;
    @JsonView(SimpleView.class)
    private String weibo;
    @JsonView(SimpleView.class)
    private LocalDateTime dateTime;

    public WeiboData(String userImageUrl, String userName, String weibo, String dateTime) {
        this.userImageUrl = userImageUrl;
        this.userName = userName;
        this.weibo = weibo;
        this.dateTime = LocalDateTime.parse(dateTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
    }

    public String getUserImageUrl() {
        return userImageUrl;
    }

    public void setUserImageUrl(String userImageUrl) {
        this.userImageUrl = userImageUrl;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getWeibo() {
        return weibo;
    }

    public void setWeibo(String weibo) {
        this.weibo = weibo;
    }

    public LocalDateTime getDateTime() {
        return dateTime;
    }

    public void setDateTime(LocalDateTime dateTime) {
        this.dateTime = dateTime;
    }
}
